package com.cj.library.widget.recyclerview.itemanimator;

import android.animation.ObjectAnimator;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;

/**
 * Created by peter on 2016/9/8.
 */
public class ViewAnimatorUtiles {

    public static void enterFromLeft(View view) {
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -view.getWidth(), 0);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(1000);
        animator.start();
    }

    public static void enterFromRight(View view) {
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(1000);
        animator.start();
    }

    public static void enterFromDown(View view) {
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", view.getHeight(), 0);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(1000);
        animator.start();
    }

    public static void enterFromUp(View view) {
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", -view.getHeight(), 0);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(1000);
        animator.start();
    }

    public static void enterScaleX(View view) {
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "scaleX", 0.2f, 1);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(1000);
        animator.start();
    }

}
